package edu.guet.server.controller;

import edu.guet.server.model.dto.Survey;
import edu.guet.server.service.PaperService;
import edu.guet.server.utils.ResultAPI;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/survey")
public class SurveyController {
    @Autowired
    PaperService paperService;

    /**
     * 展示调查问卷
     * @return
     */
    @GetMapping
    public ResultAPI showSurvey() {
        Integer paperId = 54;
        Survey survey=paperService.selectPaper(paperId);
        survey.setQuestionsList(paperService.selectQSelectList(paperId));
        return ResultAPI.success(survey);
    }
}